//2009/09/08 12:08:59
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class TeXLeX
{
public:
    vector <int> getTokens(string input)
    {
        vector<int> ret;
        ret.clear();
        for (int i=0; i<input.size(); i++)
        {
            if (i+3<input.size() && input[i]=='^' && input[i+1]=='^' && ishex(input[i+2]) && ishex(input[i+3]))
            {
                if (isalpha(input[i+2])) input[i+2] += -'a' + '0' + 10;
                if (isalpha(input[i+3])) input[i+3] += -'a' + '0' + 10;
                //cout << input[i+2] << ", " << input[i+3] << endl;
                int temp = 16*(input[i+2]-'0') + (input[i+3]-'0');
                string s;
                s += temp;
                input.replace(i, 4, s);
                //ret.push_back(temp);
                //i += 3;
                i--;
                cout << "1:" << temp << endl;
                continue;
            }
            if (i+2<input.size() && input[i]=='^' && input[i+1]=='^')
            {
                if (input[i+2] > 63)
                {
                    cout << "2: " << input[i+2]-64 << endl;
                    //ret.push_back(input[i+2]-64);
                    //i += 2;
                    string s;
                    s += input[i+2]-64;
                    input.replace(i, 3, s);
                    i--;
                    continue;
                }
                if (input[i+2] < 64)
                {
                    cout << "3: " << input[i+2]+64 << endl;
                    //ret.push_back(input[i+2]+64);
                    //i += 2;
                    string s;
                    s += input[i+2]+64;
                    input.replace(i, 3, s);
                    i--;
                    continue;
                }
            }
        }
        for (int i=0; i<input.size(); i++)
            ret.push_back((input[i]+256)%256);
        return ret;
    }
    bool ishex(char c)
    {
        if ((c>='0' && c<='9') || (c>='a'&&c<='f')) return true;
        return false;
    }
};
